package test6;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class test{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int i;
        Queue<Integer> Q1 = new LinkedList<Integer>();
        Queue<Integer> Q2 = new LinkedList<Integer>();
        for(i=0;i<N;i++)
        {
            int temp;
            temp=sc.nextInt();
            if(temp%2!=0){
                Q1.add(temp);
            }
            else
            {
                Q2.add(temp);
            }
        }
        if(!Q1.isEmpty()){
            System.out.print(Q1.peek());
            Q1.remove();
            if(!Q1.isEmpty()||!Q2.isEmpty())
                System.out.print(" ");
            i=1;
        }
        else{
            System.out.print(Q2.peek());
            Q2.remove();
            if(!Q1.isEmpty()||!Q2.isEmpty())
                System.out.print(" ");
        }
        while(!Q2.isEmpty()||!Q1.isEmpty()){
            i++;
            if(i%2!=0){
                if(!Q1.isEmpty()){
                    System.out.print(Q1.peek());
                    Q1.remove();
                    if(!Q1.isEmpty()||!Q2.isEmpty())
                        System.out.print(" ");
                }
            }
            else{
                if(!Q1.isEmpty()){
                    System.out.print(Q1.peek());
                    Q1.remove();
                    if(!Q1.isEmpty()||!Q2.isEmpty())
                        System.out.print(" ");
                }
                if(!Q2.isEmpty()){
                    System.out.print(Q2.peek());
                    Q2.remove();
                    if(!Q1.isEmpty()||!Q2.isEmpty())
                        System.out.print(" ");
                }
            }
        }


    }

}